<!DOCTYPE html>
<html>
	<head>
		<#include "/templates/commons/head.html">
		<script type="text/javascript">
			/**
			 *点击查询按钮，查询用户列表
			 */
			function query() {
				document.opForm.action = "${ctx!}/UserController/queryList.do";
				document.opForm.submit();
			}
			/**
			 *点击添加按钮进入添加页面
			 */
			function add() {
				document.opForm.action = "${ctx!}/UserController/add.do";
				document.opForm.submit();
			}
			/**
			 *点击添加按钮进入添加页面
			 */
			function edit(id) {
				document.opForm.action = "${ctx!}/UserController/edit.do?userId=" + id;
				document.opForm.submit();
			}
			/**
			 *点击添加按钮进入添加页面
			 */
			function del() {
				if (seleBox("ids")) {
					if (confirm("您是否确定要删除？")) {
						document.opForm.action = "${ctx!}/UserController/delete.do";
						document.opForm.submit();
					}
				}
			}
			/**
			 * 暂停用户的登录功能
			 */
			function pause() {
				if (seleBox("ids")) {
					if (confirm("您是否确定要暂停用户？")) {
						document.opForm.action = "${ctx!}/UserController/pause.do";
						document.opForm.submit();
					}
				}
			}
			/**
			 * 启动用户的登录功能
			 */
			function reStart() {
				if (seleBox("ids")) {
					if (confirm("您是否确定要启用用户？")) {
						document.opForm.action = "${ctx!}/UserController/reStart.do";
						document.opForm.submit();
					}
				}
			}
		</script>
	</head>
	<body>
		<div id="div-body" class="body">
			<form id="opForm" name="opForm" method="post">
				<div class="search-head">
					<!-- 顶部搜索&按钮栏 Start -->
					<blockquote class="layui-elem-quote">
						<!-- 头部右边搜索条件 Start -->
			            <div class="layui-form layui-list-btn-group">
		                	<!-- 关键字搜索 Start -->
		                	<div class="input-block">
			                	<label class="layui-form-label">关键字：</label>
			                    <div class="layui-input-inline">
			                    	<input type="text" name="param_keyWord" placeholder="账号，姓名" value="${Request.param_keyWord!}" autocomplete="off" class="layui-input"/>
			                    </div>
		                	</div>
		                	<!-- 关键字搜索 End -->
			            </div>
			            <!-- 头部右边搜索条件 End -->
					</blockquote>
					<!-- 按钮 Start -->
			        <blockquote class="layui-elem-quote list-btn-group">
						<div class="layui-btn-group">
							<#if Session.CUR_MENU.addRole == 1>
								<button class="layui-btn" type="button" onclick="add();"><i class="layui-icon">&#xe654;</i>新增</button>
							</#if>
							<#if Session.CUR_MENU.deleteRole == 1>
								<button class="layui-btn" type="button" onclick="del();"><i class="layui-icon">&#xe640;</i>删除</button>
							</#if>
							<#if Session.CUR_MENU.updateRole == 1>
								<input type="button" class="layui-btn" onclick="reStart();" value="启用">
							</#if>
							<#if Session.CUR_MENU.updateRole == 1>
								<input type="button" class="layui-btn" onclick="pause();" value="暂停">
							</#if>
						</div>
						<#if Session.CUR_MENU.selectRole == 1>
							<button class="layui-btn query-btn layui-btn-danger" type="button" onclick="query();"><i class="layui-icon">&#xe615;</i>查询</button>
						</#if>
			        </blockquote>
					<!-- 按钮 End -->
				</div>
		        <!-- table list group Start -->
				<div class="container">
					<!-- message Start -->
		        	<div id="div-message">${message!}</div>
		        	<!-- message End -->
		        	<!-- table list Start -->
					<div class="data-grid-group">
						<table lay-filter="data-grid" class="layui-table dymanic-table">
							<thead>
								<tr>
									<th lay-data="{field:'ids', checkbox: true, align: 'center', width: '10%'}"></th>
									<th lay-data="{field:'index', align: 'center', width: '10%'}">序号</th>
									<th lay-data="{field:'account', align: 'center', sort:true, width: '10%'}">帐号</th>
									<th lay-data="{field:'userName', align: 'center', sort:true, width: '15%'}">姓名</th>
									<th lay-data="{field:'sex', align: 'center', sort:true, width: '10%'}">性别</th>
									<th lay-data="{field:'mobile', align: 'center', sort:true, width: '15%'}">联系电话</th>
									<th lay-data="{field:'roleNames', align: 'center', sort:true, width: '15%'}">角色</th>
									<th lay-data="{field:'statusName', align: 'center', sort:true, width: '15%'}">状态</th>
								</tr>
							</thead>
							<tbody>
								<#if resultList?exists>
									<#list resultList as UserBean>
										<tr>
											<td>
												<input name="ids" lay-skin="primary" type="checkbox" value="${UserBean.userId!}"/>
											</td>
											<td>${UserBean_index + 1}</td>
											<td>
												<a href="javascript:void(0);" onclick="edit('${UserBean.userId!}')">${UserBean.account!'-'}</a>
											</td>
											<td class="nowr">${UserBean.userName!'-'}</td>
											<td><@dict type='sex' value='${UserBean.sex!}'>${typeName!'-'}</@dict></td>
											<td>${UserBean.mobile!'-'}</td>
											<td class="nowr">${UserBean.roleNames!'-'}</td>
											<td>${UserBean.statusName!'-'}</td>
										</tr>
									</#list>
								</#if>
							</tbody>
						</table>
					</div>
					<!-- table list End -->
				</div>
				<!-- table list group End -->
			</form>
		</div>
	</body>
</html>